import { defHttp } from '/@/utils/http/axios';
import {DemoParams, DemoListGetResultModel,TaskContResultModel,TaskreleaseResultModel} from './model/taskModel';
import { AffectedRowsResultModel } from '/@/api/learningcorner/model/userModel';

enum Api{
  DEMO_LIST = '/task/index',
  GETTASKCONT = '/task/submit/query',
  Relaese = '/task/release',
  Task_sub = "/task/submit"
}

export const demoListApi = (params:DemoParams)=>
  defHttp.get<DemoListGetResultModel>({
    url:Api.DEMO_LIST,
    params,
    headers:{
      ignoreCancelToken:true,
    },
  });

export const GetContApi = (id:string) =>{
  return defHttp.get<TaskContResultModel>({
    url:Api.GETTASKCONT,
    params:id
  })
};

export const RealeseTask = (taskrelases:any)=>{
  return defHttp.post<AffectedRowsResultModel>({
    url:Api.Relaese,
    params:taskrelases

  })
}

export const TaskSubApi = (task_sub:any)=>{
  return defHttp.post<AffectedRowsResultModel>({
    url:Api.Task_sub,
    params:task_sub,
  })
}
